package com.leo.foodmaster.admin.customer.service.impl;

import org.springframework.stereotype.Service;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.leo.foodmaster.admin.customer.dto.CustomerDeliveryRouterDTO;
import com.leo.foodmaster.admin.customer.entity.CustomerDeliveryRouterEntity;
import com.leo.foodmaster.admin.customer.mapper.CustomerDeliveryRouterMapper;
import com.leo.foodmaster.admin.customer.service.ICustomerDeliveryRouterService;
import lombok.AllArgsConstructor;

/**
 * 配送线路
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2021-11-20
 */
@Service
@AllArgsConstructor
public class ICustomerDeliveryRouterServiceImpl extends ServiceImpl<CustomerDeliveryRouterMapper, CustomerDeliveryRouterEntity> implements ICustomerDeliveryRouterService {

	private final CustomerDeliveryRouterMapper customerDeliveryRouterMapper;
	@Override
	public IPage<CustomerDeliveryRouterEntity> page(IPage<CustomerDeliveryRouterDTO> page, CustomerDeliveryRouterDTO customerDeliveryRouterdto) {
			CustomerDeliveryRouterEntity customerDeliveryRouterentity=new CustomerDeliveryRouterEntity();
		BeanUtil.copyProperties(customerDeliveryRouterdto,customerDeliveryRouterentity);
		LambdaQueryWrapper<CustomerDeliveryRouterEntity> eq = Wrappers.lambdaQuery(customerDeliveryRouterentity);
		return customerDeliveryRouterMapper.selectPage(new Page<>(page.getCurrent(),page.getSize()), eq);
	}

	@Override
	public IPage<CustomerDeliveryRouterDTO> pageList(IPage<CustomerDeliveryRouterDTO> page,CustomerDeliveryRouterDTO customerDeliveryRouterDTO) {

		return customerDeliveryRouterMapper.pageList(page,customerDeliveryRouterDTO);
	}}
